<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>编写四则运算</title>
	</head>
	<body>
		<input name="btn" type="button" value="四则运算" onclick="jisuan();" />
		<script type="text/javascript">
			function jisuan(){
				var po1=parseInt(prompt("请输入第一个数",""));
				var po2=parseInt(prompt("请输入第二个数",""));
				var op=prompt("请输入操作符(+,-,*,/)","");
				
				switch (op){
					case "+":
					//加法为啥不能出现结果
						var result=po1+po2;
						break;
					case "-":
						var result=po1-po2;
						break;
					case "*":
						var result=po1*po2;
						break;
					case "/":
						var result=po1/po2;
						break;
					default:
						document.write("您输入的操作符不存在！")
						break;
				}
				alert(result);
			}
			
		</script>
	</body>
</html>
